package top.starshine.pack;

import java.util.Objects;

/**
 * <h1 color="#409EFF"> 系统 StringBuilder 对象池属性 </h1>
 *
 * @Since: 🫵👁️👁️👉 [ @git/develop ][ @date/2025-09-09 ][ @author/??? ]
 */
@ToJson
public class SystemStringBuilderPoolProperties implements JsonSerializable {

    /**
     * <h2 color="#409EFF"> 最大数量 </h2>
     *
     * @Since: 🫵👁️👁️👉 [ @git/develop ][ @date/2025-09-09 ][ @author/??? ]
     */
    private Integer maxSize;

    /**
     * <h2 color="#409EFF"> 最大空闲时间(Millis) </h2>
     *
     * @Since: 🫵👁️👁️👉 [ @git/develop ][ @date/2025-09-09 ][ @author/??? ]
     */
    private Integer maxIdleTime;

    /** StringBuilder 的 value 数组初始值 */
    private Integer stringBuilderInitSize;

    /** StringBuilder 的 value 数组最大值  */
    private Integer stringBuilderMaxSize;

    public SystemStringBuilderPoolProperties () {
        this.maxSize = 10;
        this.maxIdleTime = 6 * 60;// 6 * 60 = 6 分钟
        this.stringBuilderInitSize = 100;
        this.stringBuilderMaxSize = 10 * 1000;// 100 * 1000 >>> 10 * 1000 byte = 10000 一万 byte >>> 0.01 MB
        //this.stringBuilderMaxSize = 100 * 1000;// 0.10 MB
    }

    @Deprecated
    public SystemStringBuilderPoolProperties (
            Integer maxSize,
            Integer maxIdleTime
    ) {
        this.maxSize = maxSize;
        this.maxIdleTime = maxIdleTime;
    }

    public SystemStringBuilderPoolProperties (
            Integer maxSize,
            Integer maxIdleTime,
            Integer stringBuilderInitSize,
            Integer stringBuilderMaxSize
    ) {
        this.maxSize = maxSize;
        this.maxIdleTime = maxIdleTime;
        this.stringBuilderInitSize = stringBuilderInitSize;
        this.stringBuilderMaxSize = stringBuilderMaxSize;
    }

    //_________________________________ 🫵👁️👁️👉[ @git/master ][ @date/2025-10-13 ][ @author/??? ]

    public Integer getStringBuilderInitSize () {
        return stringBuilderInitSize;
    }

    public void setStringBuilderInitSize (Integer stringBuilderInitSize) {
        this.stringBuilderInitSize = stringBuilderInitSize;
    }

    public Integer getStringBuilderMaxSize () {
        return stringBuilderMaxSize;
    }

    public void setStringBuilderMaxSize (Integer stringBuilderMaxSize) {
        this.stringBuilderMaxSize = stringBuilderMaxSize;
    }

    public Integer getMaxSize () {
        return maxSize;
    }

    public void setMaxSize (Integer maxSize) {
        this.maxSize = maxSize;
    }

    public Integer getMaxIdleTime () {
        return maxIdleTime;
    }

    public void setMaxIdleTime (Integer maxIdleTime) {
        this.maxIdleTime = maxIdleTime;
    }

    @Override
    public boolean equals (Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SystemStringBuilderPoolProperties that = (SystemStringBuilderPoolProperties) o;
        return Objects.equals(maxSize, that.maxSize) && Objects.equals(maxIdleTime, that.maxIdleTime) && Objects.equals(stringBuilderInitSize, that.stringBuilderInitSize) && Objects.equals(stringBuilderMaxSize, that.stringBuilderMaxSize);
    }

    @Override
    public int hashCode () {
        return Objects.hash(maxSize, maxIdleTime, stringBuilderInitSize, stringBuilderMaxSize);
    }

    @Override
    public String toString () {
        return "SystemStringBuilderPoolProperties{" +
                "maxSize=" + maxSize +
                ", maxIdleTime=" + maxIdleTime +
                ", stringBuilderInitSize=" + stringBuilderInitSize +
                ", stringBuilderMaxSize=" + stringBuilderMaxSize +
                '}';
    }

}
